﻿<!--#include file="utf-8.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="seeion.asp"-->
<!--#include file="page.asp"-->
<!--#include file="sqlerr.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="images/style.css" type="text/css" rel="stylesheet" />
<script>
function sel(){
var cs=document.all.item("classid");
var f=document.all.item("cb_all",0).checked;
//alert();
//return;
for(var i=0;i<cs.length;i++){
cs(i).checked=f?true:false;
}
}
</script>
</head>
<body>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="head"><strong>名人管理</strong></td>
</tr>
<tr>
<td>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="head_chile">
    <tr>
    <td width="3%" align="center"><input name="cb_all" type="checkbox" id="cb_all" onClick="sel();" value="checkbox"></td>
    <td width="10%" align="center">名人照片</td>
    <td>名人名称</td>
    <td width="10%" align="center">所属分类</td>
    <td width="10%" align="center">修改</td>
    </tr>
    </table>
<%
set rs=server.createobject("adodb.recordset") 
exec="select * from Celeb order by id desc" 
rs.open exec,conn,1,1 
if rs.eof then
response.Write "&nbsp;暂无名人！"
else
rs.PageSize =20 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize=rs.PageSize
maxpage=rs.PageCount 
page=request("page")
if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif  page>maxpage then
page=maxpage
end if
rs.AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if	
%>
<form method="POST" action="Manage_Celeb.asp?type=del">
<%For i=1 To x%>

    <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
    <tr>
    <td width="1%" align="center"><input type="checkbox" name="classid" value="<%=rs("id")%>"></td>
    <td width="10%" align="center"><a href="<%=rs("Photo")%>" target="_blank"><img src="<%=rs("Photo")%>" width="60" height="40"></a></td>
    <td><a href="admin_Celeb.asp?type=update&id=<%=rs("id")%>" style="font-size:14px; color:#003399;" ><%=left(rs("Name"),30)%></a></td>
    <td width="10%" align="center"><%
	sql2="select * from Sort_Celeb where id="&rs("SortID") 
	set rs2=server.CreateObject("adodb.recordset")
	rs2.open sql2,conn,1,3
	if not rs2.eof then
		response.Write (rs2("Name"))
	end if 
	rs2.movenext
	rs2.close 
	set rs2=nothing
%></td>
    <td width="10%" align="center"><a href="admin_Celeb.asp?type=update&id=<%=rs("id")%>">修改</a></td>
    </tr>
    </table>
    
<%rs.movenext
next
%>
<%end if%>

<br>
<input class="button_01" type="submit" value="删除选中" name="B1">
</form>
</td>
</tr>
<tr>
<td>
<%'以下显示分页
call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center>")
rs.close
set rs=nothing
%>
</td>
</tr>
</table>
</body>
</html>

<%
if Request.QueryString("type")="del" then
	if Request("classid")="" then
		Response.Write "<script>alert('请选择要删除的新闻！');window.location.href='Manage_Celeb.asp';</script>" 
		response.end()
	end if
	sql="delete from Celeb where id in ("&Request("classid")&")"
	
	
	conn.Execute ( sql )
	Response.Write "<script>alert('已成功删除选中的名人记录!');window.location.href='Manage_Celeb.asp';</script>" 
end if
%>